<include file="public:header" />
<div class="toptip">
    <div class="toptit">提示：</div>
    <p>发送邮件请确认您的邮件配置正确，具体请在 “系统 > 邮件设置”中设置。</p>
</div>
<div class="seltpye_x">
    <div class="left">筛选类型</div>
    <div class="right">
        <a href="{:P(array('m_type'=>0))}" <if condition='$Think.get.m_type eq "" || $Think.get.m_type eq 0'>class="select"</if>>不限</a>
        <a href="{:P(array('m_type'=>1))}" <if condition='$Think.get.m_type eq 1'>class="select"</if>>等待发送</a>
        <a href="{:P(array('m_type'=>2))}" <if condition='$Think.get.m_type eq 2'>class="select"</if>>发送成功</a>
        <a href="{:P(array('m_type'=>3))}" <if condition='$Think.get.m_type eq 3'>class="select"</if>>发送失败</a>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
</div>
<form id="form1" name="form1" method="post" action="{:U('del')}">
    <div class="list_th">
        <div class="td" style=" width:10%;">
            <label id="chkAll" class="left_padding">
                <input type="checkbox" name="chkAll" id="chk" title="全选/反选"/>类型
            </label>
        </div>
        <div class="td" style=" width:15%;">收件地址</div>
        <div class="td" style=" width:10%;">邮件主题</div>
        <div class="td" style=" width:35%;">邮件内容</div>
        <div class="td center" style=" width:10%;">添加时间</div>
        <div class="td center" style=" width:10%;">发送时间</div>
        <div class="td center" style=" width:10%;">操作</div>
        <div class="clear"></div>
    </div>
    <volist name="list" id="vo">
    <div class="list_tr link_black">
        <div class="td" style=" width:10%;">
            <div class="left_padding striking">
                <input type="checkbox" name="id[]"  value="{$vo.m_id}"/>
                <if condition="$vo['m_type'] eq 1"><span style="color:#FF6600">等待发送</span></if>
                <if condition="$vo['m_type'] eq 2"><span style="color:#009900">发送成功</span></if>
                <if condition="$vo['m_type'] eq 3"><span style="color:#666666">发送失败</span></if>
            </div>
        </div>
        <div class="td" style=" width:15%;">{$vo.m_mail}</div>
        <div class="td vtip" title="{$vo['m_subject']|nl2br}" style=" width:10%;">{$vo['m_subject_']}</div>
        <div class="td vtip" title="{$vo['m_body']|nl2br}" style=" width:35%;">{$vo['m_body_']}</div>
        <div class="td center" style=" width:10%;">{:admin_date($vo['m_addtime'])}</div>
        <div class="td center" style=" width:10%;">
            <if condition="$vo['m_sendtime'] eq 0">
            ----
            <else />
            {:admin_date($vo['m_sendtime'])}
            </if>
        </div>
        <div class="td center edit" style=" width:10%;"><a href="{:U('mailqueue_edit',array('m_id'=>$vo['m_id']))}">修改</a></div>
        <div class="clear"></div>
    </div>
    </volist>
    <empty name="list">
    <div class="list_empty">没有任何信息！</div>
    </empty>
    <span id="OpDel">
    </span>
    <span id="OpSend">
    </span>
</form>
<div class="list_foot">
    <div class="btnbox">
        <input type="button" name="Submit22" value="发送" class="admin_submit" id="ButSend"/>
        <input type="button" name="Submit22" value="添加任务" class="admin_submit"    onclick="window.location='{:U('mailqueue_add')}'"/>
        <input type="button" name="Submit22" value="批量添加" class="admin_submit"    onclick="window.location='{:U('mailqueue_batchadd')}'"/>
        <input type="button" name="ButDel" id="ButDel" value="删除" class="admin_submit" />
    </div>
    <div class="footso">
        <form action="?" method="get">
            <div class="sobox">
                <input type="hidden" name="m" value="{:C('admin_alias')}">
                <input type="hidden" name="c" value="{:CONTROLLER_NAME}">
                <input type="hidden" name="a" value="{:ACTION_NAME}">
                <input name="key" type="text" class="sinput" value="{$Think.get.key}"/>
                <input name="key_type" id="J_key_type_id" type="hidden" value="{$Think.get.key_type|default='1'}" />
                <input name="key_type_cn" id="J_key_type_cn" type="hidden" value="{$Think.get.key_type_cn|default='邮件主题'}"/>
                <input name="" type="submit" value="" class="sobtn"/>
                <div class="sotype" id="J_key_click">{$Think.get.key_type_cn|default='邮件主题'}</div>
                <div class="mlist" id="J_mlist">
                    <ul>
                        <li id="1" title="邮件主题">邮件主题</li>
                        <li id="2" title="收件地址">收件地址</li>
                    </ul>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="pages">{$page}</div>
</div>
<include file="public:footer" />
<script type="text/javascript">
    $(document).ready(function() {
        showmenu("#key_type_cn","#sehmenu","#key_type");
        //发送
        $("#ButSend").click(function () {
            var data = $("form[name=form1]").serialize();
            var qsDialog = $(this).dialog({
                title: '请选择',
                loading: true,
                footer : false
            });
            var url = "{:U('Ajax/send_mail_queue')}";
            $.post(url,data, function (result) {
                if(result.status == 1){
                    qsDialog.setContent(result.data);
                } else {
                    qsDialog.hide();
                    disapperTooltip('remind',result.msg);
                }
            });
        })

        // 删除
        $("#ButDel").click(function () {
            var data = $("form[name=form1]").serialize();
            var qsDialog = $(this).dialog({
                title: '您要删除哪些信息',
                loading: true,
                footer : false
            });
            var url = "{:U('Ajax/delete_mail_queue')}";
            $.post(url, data,function (result) {
                if(result.status == 1){
                    qsDialog.setContent(result.data);
                } else {
                    qsDialog.hide();
                    disapperTooltip('remind',result.msg);
                }
            });
        })
    });
</script>
</body>
</html>